<template>
  <div class="my">
    <div class="header">
      <div class="top">
        <div class="left" @click="$router.push('/home/myInfo')">
          <h3 class="username">{{ userInfo.nickname }}</h3>
          <div class="txt">{{ userInfo.intro }}</div>
        </div>
        <img
          v-if="userInfo.avatar"
          :src="baseUrl + userInfo.avatar"
          alt=""
          class="right"
          @click="$router.push('/home/myInfo')"
        />
        <img
          v-else
          src="@/assets/logo.png"
          alt=""
          class="right"
          @click="$router.push('/home/myInfo')"
        />
      </div>
      <div class="middle">
        <div class="item">
          <div class="num">298</div>
          <div class="message">累积答题</div>
        </div>
        <div class="item">
          <div class="num">98</div>
          <div class="message">收藏题目</div>
        </div>
        <div class="item">
          <div class="num">198</div>
          <div class="message">我的错题</div>
        </div>
        <div class="item">
          <div class="num">76<span class="one">%</span></div>
          <div class="message">正确率</div>
        </div>
      </div>
      <!-- 使用组件 -->
      <my-cell
        class="c"
        icon="&#xe64d;"
        title="我的岗位"
        right="前端开发"
      ></my-cell>
    </div>
    <div class="content">
      <div class="data">
        <h3 class="title">面经数据</h3>
        <div class="data-item">
          <div class="item">
            <div class="o1">昨日阅读<span class="num">+300</span></div>
            <div class="o2">17</div>
            <div class="o3">阅读总数</div>
          </div>
          <div class="item">
            <div class="o1">昨日获赞<span class="num">+300</span></div>
            <div class="o2">297</div>
            <div class="o3">获赞总数</div>
          </div>
          <div class="item">
            <div class="o1">昨日新增<span class="num">+12</span></div>
            <div class="o2">187</div>
            <div class="o3">评论总数</div>
          </div>
        </div>
      </div>
      <div class="Tcell">
        <my-cell icon="&#xe655;" title="我的面经分享" right="21"></my-cell>
        <my-cell icon="&#xe656;" title="我的信息" right="98"></my-cell>
        <my-cell icon="&#xe654;" title="收藏的题库" right="32"></my-cell>
        <my-cell icon="&#xe65c;" title="收藏的企业" right="32"></my-cell>
        <my-cell icon="&#xe64f;" title="我的错题" right="123"></my-cell>
        <my-cell icon="&#xe649;" title="收藏的面试经验" right="186"></my-cell>
      </div>
    </div>
  </div>
</template>
<script>
// 导入单元格组件
import myCell from './mycell'
// 导入mapState
import { mapState } from 'vuex'
export default {
  // 注册组件
  components: {
    myCell
  },
  data () {
    return {
      baseUrl: process.env.VUE_APP_URL
    }
  },
  computed: {
    ...mapState(['userInfo'])
  }
}
</script>

<style lang="less" scoped>
.my {
  .header {
    position: relative;
    width: 100%;

    background: linear-gradient(45deg, #ce0031, #b8002c);
    padding: 75px @p15;
    .top {
      display: flex;
      justify-content: space-between;
      align-items: center;
      .username {
        font-size: 21px;
        font-family: PingFangSC, PingFangSC-Semibold;
        font-weight: 600;
        text-align: left;
        color: #ffffff;
        line-height: 30px;
        letter-spacing: 0px;
        margin-bottom: 10px;
      }
      .txt {
        opacity: 0.7;
        font-size: 12px;
        font-family: PingFangSC, PingFangSC-Regular;
        font-weight: 400;
        text-align: left;
        color: #ffffff;
        line-height: 17px;
        letter-spacing: 0px;
      }
      .right {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        border: 3px solid rgba(255, 255, 255, 0.38);
        margin-right: 22px;
      }
    }
    .middle {
      display: flex;
      justify-content: space-around;
      align-items: center;
      margin-top: 35px;
      .item {
        text-align: center;
        .num {
          font-size: 21px;
          font-family: DINAlternate, DINAlternate-Bold;
          font-weight: 700;
          text-align: center;
          color: #ffffff;
          line-height: 24px;
          letter-spacing: 0px;
          .one {
            font-size: 10px;
            font-weight: 400;
          }
        }
        .message {
          opacity: 0.7;
          font-size: 12px;
          font-family: PingFangSC, PingFangSC-Regular;
          font-weight: 400;
          text-align: center;
          color: #ffffff;
          line-height: 17px;
          letter-spacing: 0px;
          margin-top: 10px;
        }
      }
    }
    .c {
      position: absolute;
      bottom: -13px;
      left: 15px;
      right: 15px;
      border-radius: 8px;
      overflow: hidden;
    }
  }
  .content {
    background-color: #f7f4f5;
    padding: 22px @p15 0;
    .title {
      font-size: 14px;
      font-family: PingFangSC, PingFangSC-Semibold;
      font-weight: 600;
      text-align: left;
      color: #181a39;
      line-height: 20px;
      letter-spacing: 0px;
      padding-left: 15px;
      margin-bottom: 15px;
    }
    .data {
      background-color: #fff;
      padding: 30px 0;
      border-radius: 8px;
      overflow: hidden;
      margin-bottom: 10px;
      .data-item {
        display: flex;
        justify-content: space-around;
        align-items: center;
        .item {
          text-align: center;
          .o1 {
            font-size: 10px;
            font-family: PingFangSC, PingFangSC-Regular;
            font-weight: 400;
            text-align: center;
            color: #b4b4bd;
            line-height: 14px;
            letter-spacing: 0px;
            .num {
              color: #00b8d4;
              font-size: 12px;
            }
          }
          .o2 {
            font-size: 21px;
            font-family: DINAlternate, DINAlternate-Bold;
            font-weight: 700;
            text-align: center;
            color: #181a39;
            line-height: 24px;
            letter-spacing: 0px;
            margin: 15px 0;
          }
          .o3 {
            font-size: 12px;
            font-family: PingFangSC, PingFangSC-Regular;
            font-weight: 400;
            text-align: center;
            color: #545671;
            line-height: 17px;
            letter-spacing: 0px;
          }
        }
      }
    }
    .Tcell {
      border-radius: 8px;
      overflow: hidden;
      padding-bottom: 15px;
    }
  }
}
</style>
